﻿Public Class Form1

    Private Sub Form1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DoubleClick
        lblLabel1.Text = "Changes:"
        lbmsgs.Text = ""
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.Top = Screen.PrimaryScreen.WorkingArea.Height - 25
    End Sub


    Private Sub WatchDdrive_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs) Handles WatchDdrive.Created
        lblLabel1.Text = "Created: "
        If IsVirus(e.Name) Then
            lbmsgs.Text = "A file named " & e.Name & " created. Scan with a good antivirus"
            Exit Sub
        End If
        lbmsgs.Text = "A file created in " & e.FullPath
    End Sub


    Private Sub WatchDdrive_Deleted(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs) Handles WatchDdrive.Deleted
        lblLabel1.Text = "Deleted: "
        lbmsgs.Text = e.Name & " is deleted"
    End Sub

    Private Function IsVirus(ByVal filename As String) As Boolean
        Select Case filename
            Case "autorun.inf"
                IsVirus = True
            Case "Autorun.inf"
                IsVirus = True
            Case Else
                IsVirus = False
        End Select
    End Function
End Class
